package org.fatmansoft.teach.controllers;

import org.fatmansoft.teach.models.StudentHonor;
import org.fatmansoft.teach.payload.request.DataRequest;
import org.fatmansoft.teach.payload.response.DataResponse;
import org.fatmansoft.teach.service.DailyActivityService;
import org.fatmansoft.teach.service.StudentHonorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/api/student-honor")
public class StudentHonorController {
    @Autowired
    StudentHonorService studentHonorService;

    //增加学生荣誉
    @PostMapping("/saveStudentHonor")
    public DataResponse insertStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.saveStudentHonor(dataRequest);
    }

    //删除学生荣誉
    @PostMapping("/deleteStudentHonor")
    public DataResponse deleteStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.deleteStudentHonor(dataRequest);
    }

    //更新日常活动
    @PostMapping("/update")
    public DataResponse updateStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.update(dataRequest);
    }

    //查找学生荣誉
    @PostMapping("/find")
    public DataResponse findStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.find(dataRequest);
    }


    //插入学生荣誉(中间表
    @PostMapping("/insertStudentStudentHonor")
    public DataResponse insertStudentStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.insertPlus(dataRequest);
    }

    //删除学生荣誉(中间表)
    @PostMapping("/deleteStudentStudentHonor")
    public DataResponse deleteStudentStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.deleteStudentStudentHonor(dataRequest);
    }

    //查找学生荣誉(中间表)
    @PostMapping("/getStudent")
    public DataResponse getStudentStudentHonor(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.getStudentHonorByStudent(dataRequest);
    }
    //借助称号级别查找学生荣誉(中间表)
    @PostMapping("/getStudentByTitleLevel")
    public DataResponse getStudentStudentHonorByTitleLevel(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.getStudentHonorByTitleLevel(dataRequest);
    }
    //查找学生荣誉
    @PostMapping("/getStudentHonorInfo")
    public DataResponse getStudentHonorInfo(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.getStudentHonorInfo(dataRequest);
    }
    //得到学生荣誉列表
    @PostMapping("/getStudentHonorList")
    public DataResponse getStudentHonorByTitleLevel(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.findByTitleLevel(dataRequest);
    }
    @PostMapping("/getStudentStudentHonorList")
    public DataResponse getStudentStudentHonorList(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.getStudentStudentHonorList(dataRequest);
    }

    @PostMapping("/getStudentStudentHonorInfo")
    public DataResponse getStudentStudentHonorInfo(@Valid @RequestBody DataRequest dataRequest) {
        return studentHonorService.getStudentStudentHonorInfo(dataRequest);
    }
}
